<template>
  <div>
    <el-affix :offset="71">
      <div class="mx-auto mt-2 w-75 text-center">
        <el-input
          placeholder="请输入笔记名字关键字"
          class="w-75"
          v-model="noteName"
          size="large"
        >
          <template #append>
            <el-button type="info" plain @click="getNoteList">
              <el-icon style="font-size: 1rem"><Search /></el-icon>
            </el-button>
          </template>
        </el-input>
      </div>
    </el-affix>
    <el-card
      shadow="hover"
      v-for="note in noteli"
      :key="note.noteId"
      class="my-2 mx-3"
    >
      <el-row>
        <el-col :span="24" class="fs-3">{{ note.noteName }}</el-col>
      </el-row>

      <el-row class="mt-2">
        <el-col :span="24" class="ps-2">
          {{ note.noteIntro }}
        </el-col>
      </el-row>

      <el-row class="mt-2">
        <el-col :span="6" class="ps-2">{{ note.publishTime }}</el-col>
        <el-col :span="3" :offset="1"
          ><el-icon class="h-100"><Star /></el-icon> {{ note.likeNum }}</el-col
        >
        <el-col :span="3"
          ><el-icon class="h-100"><ChatLineRound /></el-icon>
          {{ note.commentNum }}</el-col
        >
        <el-col :span="3"
          ><el-icon class="h-100"><View /></el-icon> {{ note.viewNum }}</el-col
        >
      </el-row>
    </el-card>
  </div>
</template>

<script>
import { Search, Star, ChatLineRound, View } from "@element-plus/icons-vue";
export default {
  name: "NoteList",
  components: {
    Search,
    Star,
    ChatLineRound,
    View,
  },
  data() {
    return {
      noteName: null,
      noteli: [],
    };
  },
  mounted() {
    this.getNoteList();
  },
  methods: {
    getNoteList() {
      this.$axios("/api/space/note/list?noteName=" + this.noteName).then(
        (response) => {
          let data = response.data;
          if (data.code == 200) {
            this.noteli = data.data;
          }
        }
      );
    },
  },


  
};
</script>

<style></style>
